//
//  ___FILENAME___
//  ___PROJECTNAME___
//
//  Created by ___FULLUSERNAME___ on ___DATE___.
//___COPYRIGHT___
//

#import "NSURL+Media.h"

@implementation NSURL (Media)

+ (NSURL *)URLWithImageId:(NSString *)imageId style:(RFImageStyle)style
{
    if (imageId.length == 0) {
        return nil;
    }
    
    if ([imageId isValidURL]) {
        NSURL *url = [NSURL URLWithString:imageId];
        if (url) {
            return url;
        }
    }
    
    NSMutableString *urlString = [NSMutableString string]; // TODO: add baseURL.
    switch (style) {
        case RFImageStyleSmall:
        {
            [urlString appendString:@"@!small"];
            break;
        }
        case RFImageStyleMedium:
        {
            [urlString appendString:@"@!medium"];
            break;
        }
        default:
            break;
    }
    return [NSURL URLWithString:urlString];
}

@end
